﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
    <script src="~/lib/stomp/stomp.js"></script>
    <script src="~/lib/im/IM.js"></script>
</head>
<body>
    <div id="imbody">
    </div>
    <div id="iminput">
        <p>
            <span>输入消息</span>
            <input type="text" id="imtxt" />
            <button type="button" id="send">发送</button>
        </p>
    </div>
    <script>
        //历史数据逻辑

        //实时接收
        var wsclient=new stompClient();
        wsclient.init("ws://192.168.1.29:15674/ws","@ViewBag.chatID",function(data)
        {
            var result=JSON.parse(data);
            wsclient.setData(result);
            $("#imbody").append('<p>'+result.Msg+'</p>');
            show(data);
        })
        function show(data)
        {
           console.table(wsclient.hashTable.getValues());
           console.log('min'+wsclient.minTimeStamp);
           console.log('max'+wsclient.maxTimeStamp);
        }
        $("#send").click(function () {
            var msg = $("#imtxt").val();
            var data = {
                tuid: '@ViewBag.tuid',
                fuid: '@ViewBag.fuid',
                msg: msg
            }
            $.post('/admin/C2CIM/Send', data, function (data) {
                console.table(data);
            });
        })
    </script>
</body>
</html>